package com.caocaog.market.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.caocaog.market.entity.dto.NightFare;
import com.caocaog.market.handler.NightFaresHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.GenericEntity;
import org.jeecg.common.system.base.entity.groups.InsertGroup;
import org.jeecg.common.system.base.entity.groups.UpdateGroup;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 店铺加价配置
 *
 * @author chechen
 * @date 2022-10-29
 */
@Data
@Accessors(chain = true)
@TableName("mk_shop_fare_config")
@EqualsAndHashCode(callSuper = false)
public class ShopFareConfig extends GenericEntity {

    /**
     * 店铺id
     */
    @TableId(type = IdType.INPUT)
    @NotBlank(message = "店铺id不能为空", groups = {InsertGroup.class, UpdateGroup.class})
    private String shopId;


    @TableField(update = "%s+1")
    private Integer lockVersion;


    /**
     * 是否开启夜间加价 0否 1是
     */
    @Dict(dicCode = "yn")
    private Integer isOpenNightlyFare = 0;


    /**
     * 夜间加价json
     */
    @TableField(jdbcType = JdbcType.VARCHAR, insertStrategy = FieldStrategy.NOT_NULL, typeHandler = NightFaresHandler.class)
    private List<NightFare> nightlyFares = new ArrayList<>();


    /**
     * 是否开启特殊天气加价 0否 1是
     */
    @Dict(dicCode = "yn")
    private Integer isOpenSpecialWeatherFare = 0;


    /**
     * 特殊天气加价
     */
    private BigDecimal specialWeatherFare = BigDecimal.ZERO;


}
